﻿using System.Globalization;
using System.Windows.Data;

namespace QH_MSS_WPF_Core.Converts
{
    public class IntToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int? i = (int?)value;
            int s = i ?? -1;
            if (s == 0)
            {
                //准备中
                return "Transparent";
            }
            else if (s == 1)
            {
                //报警
                return "Red";
            }
            else if (s == 2)
            {
                //运行
                return "Green";
            }
            else if (s == 3)
            {
                //手动模式
                return "Blue";
            }
            else if (s == 4)
            {
                //循环启动
                return "Pink";
            }
            else if (s == 5)
            {
                //单工站启动
                return "Orange";
            }
            else if (s == 9)
            {
                //单工站屏蔽中
                return "DarkViolet";
            }
            else
            {
                return "White";
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
